const tokens = {
  admin: 'admin-token',
  guest: 'guest-token',
  editor: 'editor-token'
}

export default {
  login: (config) => {
    // console.log(config, 'ccccccccccccc')
    const { username, password } = JSON.parse(config.body)
    // console.log(username, 'uuuuuuuuuuuu')
    const token = tokens[username]
    if (!token) {
      return {
        // 出错了
        status: 1,
        message: '用户名或密码错误'
      }
    }
    return {
      status: 0,
      token
    }
  }
}